import { memo, useEffect, useMemo, useRef, useState } from 'react'
import * as echarts from 'echarts'
import classNames from 'classnames'
import { isObject } from '@multi-kit/inspect'
import { SwitchButton } from '@/components'
import { Flex, Radio } from 'antd';
import { setDAC } from '@/api/common.api';

export interface Props {
  state: unknown
}

function DACConfig<Props>(props: Props) {
  const { state } = props

  const options = [
    { label: '0.0', value: '0.0' },
    { label: '0.1', value: '0.1' },
    { label: '0.2', value: '0.2' },
    { label: '0.3', value: '0.3' },
  ];

  const onChangeAction = (id, event) => {
    setDAC({ id, param: event.target.value })
  }

  return (
    <div className="grid grid-cols-6  ">
      <div className="col-span-1 p-2 text-center flex items-center justify-center">电机A</div>
      <div className="col-span-5 p-2 text-center">

        <Radio.Group block options={options} optionType="button" buttonStyle="solid" onChange={(event) => onChangeAction(0, event)} />
      </div>
      <div className="col-span-1 p-2 text-center flex items-center justify-center">电机B</div>
      <div className="col-span-5 p-2 text-center">
        <Form
          layout="inline"
          form={form}
          onFinish={(values) => saveAction(0, values)}
          className=' flex items-center justify-center gap-2'
        >

          <Form.Item name="kd" className='flex-1 m-0'>
            <InputNumber min={1} max={10} />
          </Form.Item>
          <Form.Item className='m-0'>
            <Button type="primary" htmlType="submit" >设置</Button>
          </Form.Item>
        </Form>
      </div>
    </div>
  )
}

export default memo(DACConfig)
